package com.sxt.springcloud.sys;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sxt.springcloud.sys.fallback.PermissionClientFallbackService;
import com.sxt.sys.common.DataGridView;
import com.sxt.sys.common.ResultObj;
import com.sxt.sys.domain.Notice;
import com.sxt.sys.domain.Permission;
import com.sxt.sys.vo.PermissionVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@Component
@FeignClient(value = "SPRINGCLOUD-PROVIDER-SYS",fallbackFactory = PermissionClientFallbackService.class)
@RequestMapping("/p/permission")
public interface PermissionClientService {

    //根据用户ID查询percode
    @RequestMapping("gerPercodeByUserId")
    public List<String> gerPercodeByUserId(@RequestParam("userId") Integer userId);

    /**************** 权限管理开始 ****************/

    /**
     * 加载权限管理左边的权限树的json
     */
    @RequestMapping("loadPermissionManagerLeftTreeJson")
    DataGridView loadPermissionManagerLeftTreeJson(@RequestBody PermissionVo permissionVo);


    /**
     * 查询
     */
    @RequestMapping("loadAllPermission")
    DataGridView loadAllPermission(@RequestBody PermissionVo permissionVo);

    /**
     * 加载最大的排序码
     *
     * @param
     */
    @RequestMapping("loadPermissionMaxOrderNum")
    Map<String, Object> loadPermissionMaxOrderNum();

    /**
     * 添加
     *
     * @param permissionVo
     * @return
     */
    @RequestMapping("addPermission")
    ResultObj addPermission(@RequestBody PermissionVo permissionVo);

    /**
     * 修改
     *
     * @param permissionVo
     * @return
     */
    @RequestMapping("updatePermission")
    ResultObj updatePermission(@RequestBody PermissionVo permissionVo);

    /**
     * 删除
     *
     * @param permissionVo
     * @return
     */
    @RequestMapping("deletePermission")
    ResultObj deletePermission(@RequestBody PermissionVo permissionVo);

    /**************** 权限管理结束 ****************/
}
